package com.softlab.retailwholesalesystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.softlab.retailwholesalesystem.entity.RoleEntity;
import com.softlab.retailwholesalesystem.mapper.RoleMapper;
import com.softlab.retailwholesalesystem.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, RoleEntity> implements IRoleService {

    @Autowired
    RoleMapper mapper;

    @Override
    public List<RoleEntity> select(RoleEntity role) {
        QueryWrapper<RoleEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("is_delete",0);
        if (role.getRoleId()!=null) wrapper.eq("role_id",role.getRoleId());
        if (role.getRoleName()!=null) wrapper.eq("role_name",role.getRoleName());
        return mapper.selectList(wrapper);
    }
}
